<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=1000, initial-scale=1.0, maximum-scale=1.0">
	    <!-- Loading Flat UI -->
	    <link href="public/admin/Flat/dist/css/flat-ui.css" rel="stylesheet">
	    <link href="public/admin/Flat/docs/assets/css/demo.css" rel="stylesheet">
	    <link rel="shortcut icon" href="public/admin/Flat/img/favicon.ico">
	    <!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
	    <!--[if lt IE 9]>
	      <script src="dist/js/vendor/html5shiv.js"></script>
	      <script src="dist/js/vendor/respond.min.js"></script>
	    <![endif]-->
	    <link rel="stylesheet" href="resource/hdjs/css/bootstrap.min.css">
		<script src="resource/hdjs/js/angular.min.js"></script>

		<link href="resource/hdjs/css/bootstrap.min.css" rel="stylesheet">
		<link href="resource/hdjs/css/font-awesome.min.css" rel="stylesheet">
		<script src="resource/hdjs/js/jquery.min.js"></script>
		<script src="resource/hdjs/app/util.js"></script>
		<script src="resource/hdjs/require.js"></script>
		<script src="resource/hdjs/app/config.js"></script>


	</head>
	<body>
		<table class="table table-hover">
			<tr class="active">
			  <th width="30">aid</th>
			  <th>标题</th>
			  <th width="100">分类</th>
			  <th width="200">操作</th>
			</tr>
			<?php foreach ((array)$data['data'] as $k=>$v){?>
			<tr>
				<td><?php echo $v['aid']?></td>
				<td><?php echo $v['title']?></td>
				<td><?php echo $v['cname']?></td>
				<td>
					<a href="<?php echo U('recover',array('aid'=>$v['aid']))?>" class="btn btn-sm btn-warning">还原</a>
					<a href="javascript:;" onclick="realdel(this,<?php echo $v['aid']?>);" title="<?php echo $v['title']?>" class="btn btn-sm btn-danger">彻底删除</a>
				</td>
			</tr>
			<?php }?>
		</table>
		<div class="page pagination">
				<ul>
				<?php echo $data['page']?>
				</ul>
		</div>

		<script type="text/javascript">

		function realdel(objs,aid){

			var title=$(objs).attr('title');
			// alert(title);
				// alert(1);
			require(['util'], function (util) {
			var obj = util.modal({
			       title:'确定要彻底删除吗？',//标题
			       content:'<span style="color:red;">'+title+'</span>',//内容
			       footer:'<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button><button type="button" class="btn btn-primary confirm" data-dismiss="modal">确定</button>',//底部
			       width:600,//宽度
			       events:{
			        confirm:function(){
			        //哪个元素上有.confirm类，被点击就执行这个回调
			            // alert('点击了按钮');
			            // 发送ajax
			           $.post("<?php echo U('realdel')?>",{aid:aid},function(phpData){
			//				因为要使用util对象中的提示框方法所以这里需要载入
						    require(['util'], function (util) {
								if(phpData.valid){
				//					alert('成功');
				//					util.message函数可以弹出模态框，并且输出错误消息
									util.message(phpData.message,"<?php echo U('recycle')?>",'success');
								}else{
									 util.message(phpData.message,'','error');
								}
							});
							
						},'json');		
			        }
			       }
			    });
			    //显示模态框
			    obj.modal('show');
			});

		}


		</script>







	</body>
</html>
